﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Media;
using System.IO;
using System.IO.Packaging;
using System.Windows.Xps.Packaging;
using System.Windows.Xps.Serialization;
using System.Windows.Controls;

namespace SmartPaginator
{
    public static class DocumentPaginatorExtensions
    {
        #region Paginate

        public static XpsDocumentWrapper Paginate(this DocumentPaginator paginator)
        {
            return new XpsDocumentWrapper(paginator);
        }

        #endregion

        //#region SaveAsXps

        //public static IDocumentPaginatorSource SaveAsXps(this DocumentPaginator paginator, Stream stream)
        //{
        //    Package container = Package.Open(stream, FileMode.Create);
        //    XpsDocument xpsDoc = new XpsDocument(container, CompressionOption.NotCompressed);

        //    XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(xpsDoc), false);
        //    rsm.SaveAsXaml(paginator);

        //    return xpsDoc.GetFixedDocumentSequence() as IDocumentPaginatorSource;
        //}

        //#endregion
    }
}
